/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package idea.sfo.viewer.graphics;


import designersfo.Cons.CellInfo.CellFormat;
import idea.sfo.viewer.designer.DesignerElement;
import idea.sfo.viewer.designer.DesignerElementChildren;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.util.ArrayList;


/**
 *
 * @author renke002
 */
public class HeaderContent extends ContentLayout
{

    /**
     *
     */
    private CellBorder border;
    /**
     *
     */
    private Rectangle container;
    /**
     *
     */
    private ArrayList<Drawable> graphics;
    /**
     *
     */
    private String label;


    /**
     *
     * @param graphics
     * @param container
     * @param cellFormat
     */
    public HeaderContent( ArrayList<Drawable> graphics , Rectangle container , CellFormat cellFormat )
    {
        this.graphics = graphics;
        this.container = container;
        this.border = new CellBorder( container , cellFormat );
    }


    public HeaderContent( DesignerElementChildren dec , Rectangle container , CellFormat cellFormat )
    {
        this.border = new CellBorder( container , cellFormat );
        this.container = container;
        this.graphics = dec.getGraphics();

        // try and set this element's label
        for ( Drawable d : this.graphics )
        {
            // [1]	DesignerElement	#6401	
            if ( d instanceof DesignerElement )
            {
                this.label = ( (DesignerElement) d ).getLabel();
            }
        }

    }


    /**
     *
     * @param g2d
     */
    @Override
    public void draw( Graphics2D g2d )
    {
//        this.border.draw( g2d );
        for ( Drawable graphic : this.graphics )
        {
            graphic.draw( g2d );
        }
    }


    /**
     *
     * @return
     */
    @Override
    public String getLabel()
    {
        return this.label;
    }

//    /**
//     * 
//     * @param x
//     * @param y 
//     */
//    @Override
//    public void moveTo( int x , int y )
//    {
//        this.container.x = x;
//        this.container.y = y;
//    }
}
